<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
    function payMoney(){
        $.ajax({
            type: "POST",
            url: "/api/payMoney",
            data: {},
            success: function (data) {
                if (data==="success") {
                    location.href="success.html";
                }else {
                    location.href="failOrderList.html";
                }
            }
        });
    }

    function countDown(){
        //获取初始时间
        let time = document.getElementById("Time");
        if(time.innerHTML == 0){
            time .innerHTML = 0;
        }else{
            time.innerHTML = time.innerHTML-1;
        }
    }
    //1000毫秒调用一次
    window.setInterval("countDown()",1000);
</script>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>付款</title>
</head>
<body>
<button id="payMoney" onclick="payMoney()">付款</button><br/>
<span>支付倒计时：</span><span id="Time" >5</span>
</body>
</html>